<!DOCTYPE html>

<html>

<head>
    <meta charset="utf-8">
    <title>卫生机构</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
    <style type="text/css">
        .laytable-cell-radio.layui-table-cell {
            padding: 0 5px 0 15px;
        }
        
        .laytable-cell-radio span {
            display: none;
        }
        
        .laytable-cell-radio .layui-form-radio {
            padding-right: 0;
            margin: 0;
        }
    </style>
</head>

<body>
    <div class="layui-form" style="margin-left:20px;margin-top:15px;margin-bottom:-20px">
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:130px">搜索监管医院：</label>
            <div class="layui-inline">
                <input class="layui-input" name="id" id="demoReload" autocomplete="off" placeholder="请输入监管医院名称">
            </div>
            区域：
            <div class="layui-inline">
                <select name="area" id="area" class="layui-input" lay-search>
                        <option value=""></option>
                       
                </select>
            </div>
            <button class="layui-btn layui-btn-normal" data-type="reload" id="serch"> <i class="layui-icon">&#xe615;</i>查询</button>

        </div>
    </div>

    <table id="demo" lay-filter="test"></table>

    </div>
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script src="../../layuiadmin/layui/jquery-3.3.1.min.js"></script>
    <script>
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index']);
        $.ajax({
            url: '../../../Cust/region',
            dataType: 'json',
            type: 'get',
            success: function(res) {
                $.each(res.data, function(index) {
                    var n = res.data[index].n;
                    var value = res.data[index].value;
                    $("#area").append("<option value='" + value + "'>" + n + "</option>")

                });
                layui.form.render();
            }
        })
        layui.use('table', function() {
            var table = layui.table;
            var $ = layui.$;
            var tableIns = table.render({
                elem: '#demo',
                height: 'full-56',
                //url: '', //数据接口

                page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档							
                    limit: 20,
                    limits: [20, 40, 60, 80, 100]

                },
                cols: [
                    [
                        //表头

                        {
                            field: 'id',
                            title: '编号',
                            width: '5%',
                            sort: true,
                            show: true,
                            align: 'center'
                        }, {
                            field: 'areaname',
                            title: '物业公司',
                            width: '18%',
                            align: 'center'
                        }, {
                            field: 'address',
                            title: '医院部门',
                            width: '20%'
                        }, {
                            field: 'linkman',
                            title: '收集人员',
                            width: '10%'
                        }, {
                            field: 'linkman',
                            title: '交接人员',
                            width: '10%'
                        }, {
                            field: 'linkman',
                            title: '产废点',
                            width: '15%'
                        }, {
                            field: 'phone',
                            title: '院内总暂存间',
                            width: '15%'
                        }
                    ]
                ],
                skin: 'row' //表格风格
                    ,
                even: true
            });
            $("#serch").on('click', function() {
                tableIns.reload({
                    url: '',
                    where: {
                        custid: $("#area option:selected").val(),
                        custname: $("#demoReload").val()
                    } //设定异步数据接口的额外参数
                    ,
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                });
                $("table tr").css({
                    "background": "#1E9FFF",
                    "color": "white"
                });
            });


            $("table tr").css({
                "background": "#1E9FFF",
                "color": "white"
            });
        });
    </script>
</body>

</html>